package com.rpa.server.servicerpaserver.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * @ClassName AsyncConfig
 * @Description TODO
 * @Author 86152
 * @Date 2025/1/26 14:18
 * @Version 1.0
 **/
@Configuration
@EnableAsync
public class AsyncConfig {
    @Bean
    public ThreadPoolTaskExecutor logonTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);  // 核心线程池大小
        executor.setMaxPoolSize(20);   // 最大线程池大小
        executor.setQueueCapacity(100);  // 队列容量
        executor.setThreadNamePrefix("logon-");  // 线程名称前缀
        executor.initialize();
        return executor;
    }
    @Bean
    public ThreadPoolTaskExecutor getNameAndPictureTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);  // 核心线程池大小
        executor.setMaxPoolSize(20);   // 最大线程池大小
        executor.setQueueCapacity(100);  // 队列容量
        executor.setThreadNamePrefix("getNameAndPicture-");  // 线程名称前缀
        executor.initialize();
        return executor;
    }
    @Bean
    public ThreadPoolTaskExecutor saveCeekSettingTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);  // 核心线程池大小
        executor.setMaxPoolSize(20);   // 最大线程池大小
        executor.setQueueCapacity(100);  // 队列容量
        executor.setThreadNamePrefix("saveCeekSetting-");  // 线程名称前缀
        executor.initialize();
        return executor;
    }
    @Bean
    public ThreadPoolTaskExecutor getCourseTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);  // 核心线程池大小
        executor.setMaxPoolSize(20);   // 最大线程池大小
        executor.setQueueCapacity(100);  // 队列容量
        executor.setThreadNamePrefix("getCourse-");  // 线程名称前缀
        executor.initialize();
        return executor;
    }
    @Bean
    public ThreadPoolTaskExecutor clazzIdTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);  // 核心线程池大小
        executor.setMaxPoolSize(20);   // 最大线程池大小
        executor.setQueueCapacity(100);  // 队列容量
        executor.setThreadNamePrefix("getClassIds-");  // 线程名称前缀
        executor.initialize();
        return executor;
    }
    @Bean
    public ThreadPoolTaskExecutor clazzTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);  // 核心线程池大小
        executor.setMaxPoolSize(20);   // 最大线程池大小
        executor.setQueueCapacity(100);  // 队列容量
        executor.setThreadNamePrefix("getClass-");  // 线程名称前缀
        executor.initialize();
        return executor;
    }

    @Bean
    public ThreadPoolTaskExecutor clazzNameListTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);  // 核心线程池大小
        executor.setMaxPoolSize(20);   // 最大线程池大小
        executor.setQueueCapacity(100);  // 队列容量
        executor.setThreadNamePrefix("getClassNameList-");  // 线程名称前缀
        executor.initialize();
        return executor;
    }

    @Bean
    public ThreadPoolTaskExecutor activeListTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);  // 核心线程池大小
        executor.setMaxPoolSize(20);   // 最大线程池大小
        executor.setQueueCapacity(100);  // 队列容量
        executor.setThreadNamePrefix("getActiveList-");  // 线程名称前缀
        executor.initialize();
        return executor;
    }
    @Bean
    public ThreadPoolTaskExecutor activeTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);  // 核心线程池大小
        executor.setMaxPoolSize(20);   // 最大线程池大小
        executor.setQueueCapacity(100);  // 队列容量
        executor.setThreadNamePrefix("getActive-");  // 线程名称前缀
        executor.initialize();
        return executor;
    }
    @Bean
    public ThreadPoolTaskExecutor workTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);  // 核心线程池大小
        executor.setMaxPoolSize(20);   // 最大线程池大小
        executor.setQueueCapacity(100);  // 队列容量
        executor.setThreadNamePrefix("getWork-");  // 线程名称前缀
        executor.initialize();
        return executor;
    }
    @Bean
    public ThreadPoolTaskExecutor testTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);  // 核心线程池大小
        executor.setMaxPoolSize(20);   // 最大线程池大小
        executor.setQueueCapacity(100);  // 队列容量
        executor.setThreadNamePrefix("getTest-");  // 线程名称前缀
        executor.initialize();
        return executor;
    }

    @Bean
    public ThreadPoolTaskExecutor activeDetailTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);  // 核心线程池大小
        executor.setMaxPoolSize(20);   // 最大线程池大小
        executor.setQueueCapacity(100);  // 队列容量
        executor.setThreadNamePrefix("getClassNameList-");  // 线程名称前缀
        executor.initialize();
        return executor;
    }
    @Bean
    public ThreadPoolTaskExecutor workListTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);  // 核心线程池大小
        executor.setMaxPoolSize(20);   // 最大线程池大小
        executor.setQueueCapacity(100);  // 队列容量
        executor.setThreadNamePrefix("getWorkList-");  // 线程名称前缀
        executor.initialize();
        return executor;
    }
    @Bean
    public ThreadPoolTaskExecutor workDetailTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);  // 核心线程池大小
        executor.setMaxPoolSize(20);   // 最大线程池大小
        executor.setQueueCapacity(100);  // 队列容量
        executor.setThreadNamePrefix("getWorkDetail-");  // 线程名称前缀
        executor.initialize();
        return executor;
    }
    @Bean
    public ThreadPoolTaskExecutor testListTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);  // 核心线程池大小
        executor.setMaxPoolSize(20);   // 最大线程池大小
        executor.setQueueCapacity(100);  // 队列容量
        executor.setThreadNamePrefix("getTestList-");  // 线程名称前缀
        executor.initialize();
        return executor;
    }
    @Bean
    public ThreadPoolTaskExecutor testDetailTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);  // 核心线程池大小
        executor.setMaxPoolSize(20);   // 最大线程池大小
        executor.setQueueCapacity(100);  // 队列容量
        executor.setThreadNamePrefix("getTestDetail-");  // 线程名称前缀
        executor.initialize();
        return executor;
    }


}
